import type { FormOption } from "@/view/compont/crud/component/formDialog/type";
import { FormItemType } from "@/view/compont/crud/component/formDialog/type.d";
import type { UserModel } from "./model";
import { FormRules } from "tdesign-vue-next";

export const userFormOption: FormOption<UserModel> = {
  name: {
    label: "姓名",
    type: FormItemType.Input,
  },
  age: {
    label: "年龄",
    type: FormItemType.Input,
  },
  sex: {
    label: "性别",
    type: FormItemType.Radio,
    option: [],
  },
  address: {
    label: "地址",
    type: FormItemType.Input,
  },
};

export const rules: FormRules = {
  name: [
    { required: true, message: "不能为空", trigger: "blur" },
    {
      max: 10,
      message: "字符数量不能超过 10",
      type: "warning",
      trigger: "blur",
    },
  ],
};
